package com.mrobuy.jd.api;

import com.google.gson.Gson;
import com.jd.open.api.sdk.JdClient;
import com.mrobuy.jd.JdClientFactory;
import com.mrobuy.jd.api.apply.ProductApplyAuditGetClient;
import com.mrobuy.jd.api.apply.ProductApplyFindClient;
import com.mrobuy.jd.api.category.ExtPropFindClient;
import com.mrobuy.jd.api.category.FeatureFindClient;
import com.mrobuy.jd.api.category.PropFindClient;
import com.mrobuy.jd.api.category.SalePropFindClient;
import com.mrobuy.jd.api.primarypic.PrimaryPicAppliesFindClient;
import com.mrobuy.jdvc.entity.VCItem;
import com.mrobuy.jdvc.entity.VCProduct;

public class Jos {

    public static String SERVER = "https://api.jd.com/routerjson";

    public static ProductApplyFindClient productApplyFindClient(JdClient client) {
        return new ProductApplyFindClient(client);
    }

    public static ItemProductGetClient itemProductGetClient(JdClient client) {
        return new ItemProductGetClient(client);
    }

    public static ProductInfoFindClient productInfoFindClient(JdClient client) {
        return new ProductInfoFindClient(client);
    }

    public static CategoryFindClient categoryFindClient(JdClient client) {
        return new CategoryFindClient(client);
    }

    public static BrandFindClient brandFindClient(JdClient client) {
        return new BrandFindClient(client);
    }

    public static FeatureFindClient featureFindClient(JdClient client) {
        return new FeatureFindClient(client);
    }

    public static SalePropFindClient salePropFindClient(JdClient client) {
        return new SalePropFindClient(client);
    }

    public static PropFindClient propFindClient(JdClient client) {
        return new PropFindClient(client);
    }

    public static ExtPropFindClient extPropFindClient(JdClient client) {
        return new ExtPropFindClient(client);
    }


    public static PrimaryPicAppliesFindClient primaryPicAppliesFindClient(JdClient client) {
        return new PrimaryPicAppliesFindClient(client);
    }

    public static ProductApplyAuditGetClient productApplyAuditGetClient(JdClient client) {
        return new ProductApplyAuditGetClient(client);
    }


    public static void main(String[] args) {
        try {
            VCProduct vcProduct = Jos.itemProductGetClient(JdClientFactory.jdClient())
                    .setWareId("100010469159")
                    .call();

            System.out.println(new Gson().toJson(vcProduct));

            for (VCItem vcItem : vcProduct.getVcItems()) {

                System.out.println("\t" + new Gson().toJson(vcItem));
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

    }

}
